﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>04_三维空间的观察</title>
    <script src="../js/three.js"></script>
</head>
<body>
    <script>
        var scene = new THREE.Scene();
        //var camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 1000); // 透视投影相机
        var camera = new THREE.OrthographicCamera(-100, 100, 100, -100, 0.1, 1000); // 正投影相机
        var renderer = new THREE.WebGLRenderer({
            antialias: true
        });
        renderer.setSize(window.innerWidth, window.innerHeight);
        document.body.appendChild(renderer.domElement);

        var light = new THREE.DirectionalLight(0xffffff);
        light.position.set(10, 10, 10);
        scene.add(light);

        var geometry = new THREE.CylinderGeometry(5, 10, 20);
        var material = new THREE.MeshLambertMaterial({ color: 0xffff00 });
        var cylinder = new THREE.Mesh(geometry, material);
        scene.add(cylinder);
        cylinder.position.set(-10, -20, 0);
        cylinder.rotation.set(0.3, 0, 0);

        camera.position.set(0, 0, 100);
        camera.lookAt(0, 0, 0);

        renderer.render(scene, camera);
    </script>
</body>
</html>
